package com.summer.filesync.model.manager;

import java.util.Map;

/** 文件类型分布 */
public class FileTypeDistribution {
  private Map<String, Integer> typeCounts;
  private Map<String, Long> typeSizes;
  private Map<String, Double> typePercentages;
  private int totalFileCount;
  private long totalSize;

  public FileTypeDistribution(
      Map<String, Integer> typeCounts,
      Map<String, Long> typeSizes,
      int totalFileCount,
      long totalSize) {
    this.typeCounts = typeCounts;
    this.typeSizes = typeSizes;
    this.totalFileCount = totalFileCount;
    this.totalSize = totalSize;

    // 计算百分比
    this.typePercentages = new java.util.HashMap<>();
    for (Map.Entry<String, Long> entry : typeSizes.entrySet()) {
      double percentage = totalSize > 0 ? (entry.getValue() * 100.0 / totalSize) : 0;
      typePercentages.put(entry.getKey(), percentage);
    }
  }

  // Getters
  public Map<String, Integer> getTypeCounts() {
    return typeCounts;
  }

  public Map<String, Long> getTypeSizes() {
    return typeSizes;
  }

  public Map<String, Double> getTypePercentages() {
    return typePercentages;
  }

  public int getTotalFileCount() {
    return totalFileCount;
  }

  public long getTotalSize() {
    return totalSize;
  }
}
